import { ApiReturn, ListResp } from "@/utils/request";
import request from "@/utils/request";
import ExportRequest from "@/utils/export"

export interface Activity {
  activityBlock?: number
  activityBlockValue?: string
  activityName?: string
  createTime?: string
  endTime?: string
  enrollEndTime?: string
  enrollStartTime?: string
  id?: number
  numberOfPeople?: number
  publisherTelephone?: string
  score?: number
  startTime?: string
  username?: string
  content?: string
  picture?: string
  activeTime?: Date[]
  enrollTime?: Date[]
}

export interface Score {
  boxue?: number
  className?: string
  collageName?: string
  duxing?: number
  jingmei?: number
  majorName?: string
  mingde?: number
  qualified?: number
  qualifiedValue?: string
  studentId?: string
  studentName?: string
  updateTime?: string
}

export interface Enroll {
  activityBlock?: number
  activityBlockValue?: string
  activityName?: string
  complete?: number
  completeValue?: string
  createTime?: string
  endTime?: string
  id?: number
  score?: number
  startTime?: string
  studentName?: string
  studentId?: string
  updateTime?: string
}

export class BaiyeService {
  static async listActivity(params: any): ApiReturn<ListResp<Activity>> {
    return request.get("/baiye/activity", { params })
  }

  static async upFile(params: any): ApiReturn<any> {
    return request.post("/baiye/images", params)
  }

  static async saveBaiyeActive(data: any): ApiReturn<any> {
    return request.post("/baiye/activity", data)
  }

  static async deleteActive(ids: number[]): ApiReturn<any> {
    return request.delete("/baiye/activity", { data: ids })
  }

  static async getActiveById(id: number): ApiReturn<Activity> {
    return request.get(`/baiye/activity/${id}`)
  }

  static async listScore(params: any): ApiReturn<ListResp<Score>> {
    return request.get("/baiye/accounts", { params })
  }
  static async exportScore(params: any): ApiReturn<any> {
    return ExportRequest.get("/baiye/download", { params })
  }

  static async listEnrolls(params: any): ApiReturn<ListResp<Enroll>> {
    return request.get("/baiye/activityEnroll", { params })
  }
}